String.prototype.startWith = function(str){
    if(!str||this.length<str.length){
        return false;
    }
    return this.substr(0, str.length) == str;
}

String.prototype.endWith=function(str){
    if(str==null||str==""||this.length==0||str.length>this.length)
        return false;
    if(this.substring(this.length-str.length)==str)
        return true;
    else
        return false;
}

String.prototype.right = function(len) {
    if(isNaN(len)||len==null){
        len = this.length;
    } else {
        if(parseInt(len)<0||parseInt(len)>this.length){
            len = this.length;
        }
    }
    return this.slice(this.length-len);
}

String.prototype.trim = function() {
	return this.replace(/^\s+(.*?)\s+$/, "$1");
}

var $$ = function(o){
	return document.getElementById(o);
}
